#include <stdio.h>
int GetNumberOfK1(int* data, int dataLen, int k) {
    int i = 0;
    int count = 0;
    for (i = 0; i < dataLen; i++)
    {
        if (*(data + i) == k)
        {
            count++;
        }
    }
    return count;
}
int GetNumberOfK2(int* data, int dataLen, int k)
{
    int left = 0, right = dataLen, lbound = 0, rbound = 0;
    while (left < right)
    {
        int mid = left + (right - left) / 2;
        if (*(data + mid) < k)
        {
            left = mid + 1;
        }
        else
        {
            right = mid;
        }
    }
    lbound = left;
    left = 0, right = dataLen;
    while (left < right)
    {
        int mid = left + (right - left) / 2;
        if (*(data + mid) <= k)
        {
            left = mid + 1;
        }
        else
        {
            right = mid;
        }
    }
    rbound = left;
    return rbound-lbound;
}
int main()
{
    int arr[] = { 1,2,3,3,3,4,5,6,7 };
    int sz = sizeof(arr) / sizeof(arr[0]);
    int k = 0;
    scanf_s("%d", &k);
    int ret1=GetNumberOfK1(arr, sz, k);
    int ret2= GetNumberOfK2(arr, sz, k);
    printf("%d\n", ret1);
    printf("%d\n", ret2);
    return 0;
}